package com.xjj.datarources.common;

import lombok.Data;
import sun.text.normalizer.UBiDiProps;

/**
 * @name: xjj
 * @date: 2021/5/20 10:03
 */

@Data
public class ResultVo {

    //状态码
    private int code;

    //状态信息
    private String msg;

    //返回对象
    private Object data;

    //手动设置所有返回
    public ResultVo(int code, String msg, Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    //成功状态码与数据
    public ResultVo(Object data){
        this.code = ResultCode.SUCCESS.getCode();
        this.msg = ResultCode.SUCCESS.getMsg();
        this.data = data;
    }

    //返回指定状态码与数据
    public ResultVo(StatusCode statusCode, Object data){
        this.code = statusCode.getCode();
        this.msg = statusCode.getMsg();
        this.data = data;
    }

    //只返回状态码
    public ResultVo(StatusCode statusCode){
        this.code = statusCode.getCode();
        this.msg = statusCode.getMsg();
        this.data = null;
    }





}
